package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zccw {
   private PivotTable a;
   private com.aspose.cells.b.a.d.zh b;
   private zcel c;
   private String d;

   zccw(zcel var1, PivotTable var2, String var3) throws Exception {
      this.c = var1;
      this.a = var2;
      this.b = new com.aspose.cells.b.a.d.zh();
      this.d = var3;
   }

   void a(String var1, com.aspose.cells.a.f.zj var2) throws Exception {
      this.a();
      zcel.a(var1, this.b, var2);
      this.b.a();
      this.b = null;
   }

   void a() throws Exception {
      zbxt var1 = new zbxt(this.a, this.d);
      var1.a(this.b);
      zbxp var2 = new zbxp(this.a);
      var2.a(this.b);
      zcdb var3 = new zcdb(313);
      var3.a(this.b);
      this.l(this.b);
      this.a(this.b);
      this.b(this.b);
      this.m(this.b);
      this.c(this.b);
      this.e(this.b);
      this.d(this.b);
      this.f(this.b);
      this.g(this.b);
      this.h(this.b);
      this.i(this.b);
      this.j(this.b);
      zcdb var4 = new zcdb(315);
      var4.a(this.b);
   }

   void a(com.aspose.cells.b.a.d.zh var1) throws Exception {
      PivotFieldCollection var2 = this.a.getRowFields();
      if (var2.getCount() != 0) {
         zbxf var3 = new zbxf(309, var2);
         var3.a(var1);
         zcdb var4 = new zcdb(310);
         var4.a(var1);
      }
   }

   void b(com.aspose.cells.b.a.d.zh var1) throws Exception {
      ArrayList var2 = this.a.g;
      if (var2 != null) {
         int var3 = var2.size();
         if (var3 != 0) {
            zcdb var4 = new zcdb(299, var3);
            var4.a(var1);

            for(int var5 = 0; var5 < var3; ++var5) {
               int[] var6 = (int[])((int[])var2.get(var5));
               this.a(var1, var6);
            }

            zcdb var7 = new zcdb(300);
            var7.a(var1);
         }
      }
   }

   private void a(com.aspose.cells.b.a.d.zh var1, int[] var2) throws Exception {
      zbxo var3 = new zbxo(var2);
      var3.a(var1);
      if (var2.length != 4 || var2[2] - var2[0] != 0) {
         zbxg var4 = new zbxg(var2);
         var4.a(var1);
         zcdb var5 = new zcdb(389);
         var5.a(var1);
      }

      zcdb var6 = new zcdb(298);
      var6.a(var1);
   }

   private void m(com.aspose.cells.b.a.d.zh var1) throws Exception {
      PivotFieldCollection var2 = this.a.getColumnFields();
      if (var2.getCount() != 0) {
         zbxf var3 = new zbxf(311, var2);
         var3.a(var1);
         zcdb var4 = new zcdb(312);
         var4.a(var1);
      }
   }

   void c(com.aspose.cells.b.a.d.zh var1) throws Exception {
      ArrayList var2 = this.a.h;
      if (var2 != null) {
         int var3 = var2.size();
         if (var3 != 0) {
            zcdb var4 = new zcdb(301, var3);
            var4.a(var1);

            for(int var5 = 0; var5 < var3; ++var5) {
               int[] var6 = (int[])((int[])var2.get(var5));
               this.a(var1, var6);
            }

            zcdb var7 = new zcdb(302);
            var7.a(var1);
         }
      }
   }

   void d(com.aspose.cells.b.a.d.zh var1) throws Exception {
      PivotFieldCollection var2 = this.a.getDataFields();
      int var3 = var2.getCount();
      if (var3 != 0) {
         zcdb var4 = new zcdb(295, var3);
         var4.a(var1);

         for(int var5 = 0; var5 < var3; ++var5) {
            PivotField var6 = var2.get(var5);
            zbxn var7 = new zbxn(var6);
            var7.a(var1);
            zcdb var8 = new zcdb(294);
            var8.a(var1);
         }

         zcdb var9 = new zcdb(296);
         var9.a(var1);
      }
   }

   void e(com.aspose.cells.b.a.d.zh var1) throws Exception {
      PivotFieldCollection var2 = this.a.getPageFields();
      int var3 = var2.getCount();
      if (var3 != 0) {
         zcdb var4 = new zcdb(291, var3);
         var4.a(var1);

         for(int var5 = 0; var5 < var3; ++var5) {
            PivotField var6 = var2.get(var5);
            zbxq var7 = new zbxq(var6);
            var7.a(var1);
            zcdb var8 = new zcdb(290);
            var8.a(var1);
         }

         zcdb var9 = new zcdb(292);
         var9.a(var1);
      }
   }

   void f(com.aspose.cells.b.a.d.zh var1) throws Exception {
      zbqz var2 = this.a.ag;
      if (var2 != null && 0 != var2.getCount()) {
         zcdb var3 = null;
         var3 = new zcdb(305, var2.getCount());
         var3.a(var1);
         zbqy var4 = null;
         zbze var5 = null;

         for(int var6 = 0; var6 < var2.getCount(); ++var6) {
            var4 = var2.a(var6);
            if (var4.c != null) {
               var5 = new zbze(var4);
               var5.a(var1);
               this.b(var4.c, var1);
               var3 = new zcdb(304);
               var3.a(var1);
            }
         }

         var3 = new zcdb(306);
         var3.a(var1);
      }
   }

   void g(com.aspose.cells.b.a.d.zh var1) throws Exception {
      PivotFormatConditionCollection var2 = this.a.getPivotFormatConditions();
      if (null != var2 && 0 != var2.getCount()) {
         int var3 = zavb.a(var2);
         int var4 = var2.getCount();
         int var5 = var4 - var3;
         if (var5 >= 1) {
            zcdb var6 = null;
            var6 = new zcdb(560, var5);
            var6.a(var1);
            PivotFormatCondition var7 = null;
            zbzc var8 = null;

            for(int var9 = 0; var9 < var2.getCount(); ++var9) {
               var7 = var2.get(var9);
               FormatConditionCollection var10 = var7.a();
               if (var10 != null && !var10.a(false)) {
                  var8 = new zbzc(var7);
                  var8.a(var1);
                  if (var7.b != null && 0 != var7.b.size()) {
                     var6 = new zcdb(641, var7.b.size());
                     var6.a(var1);

                     for(int var11 = 0; var11 < var7.b.size(); ++var11) {
                        if ((zbro)var7.b.get(var11) != null) {
                           this.b((zbro)var7.b.get(var11), var1);
                        }
                     }

                     var6 = new zcdb(642);
                     var6.a(var1);
                     var6 = new zcdb(559);
                     var6.a(var1);
                  }
               }
            }

            var6 = new zcdb(561);
            var6.a(var1);
         }
      }
   }

   void h(com.aspose.cells.b.a.d.zh var1) throws Exception {
      zcak var2 = new zcak(this.a);
      var2.a(var1);
   }

   void i(com.aspose.cells.b.a.d.zh var1) throws Exception {
      if (this.a.getPivotFilters() != null && this.a.getPivotFilters().getCount() != 0) {
         zcdb var2 = new zcdb(599, this.a.getPivotFilters().getCount());
         var2.a(var1);

         for(int var3 = 0; var3 < this.a.getPivotFilters().getCount(); ++var3) {
            PivotFilter var4 = this.a.getPivotFilters().get(var3);
            zbzd var5 = new zbzd(var4);
            var5.a(var1);
            if (var4.getAutoFilter() != null) {
               zcek.a(var4.getAutoFilter(), var1);
            }

            zcdb var6 = new zcdb(602);
            var6.a(var1);
         }

         zcdb var7 = new zcdb(600);
         var7.a(var1);
      }
   }

   void j(com.aspose.cells.b.a.d.zh var1) throws Exception {
      zbzn var2 = new zbzn();
      var2.a(var1);
      zbzi var3 = new zbzi(this.a);
      var3.a(var1);
      this.k(var1);
      zcdb var4 = new zcdb(1063);
      var4.a(var1);
      zcdb var5 = new zcdb(36);
      var5.a(var1);
   }

   void k(com.aspose.cells.b.a.d.zh var1) throws Exception {
      PivotFormatConditionCollection var2 = this.a.getPivotFormatConditions();
      if (null != var2 && 0 != var2.getCount()) {
         int var3 = zavb.a(var2);
         if (var3 >= 1) {
            zcdb var4 = null;
            zbza var5 = new zbza(var3);
            var5.a(var1);
            PivotFormatCondition var6 = null;
            zbzb var7 = null;
            zbzh var8 = null;

            for(int var9 = 0; var9 < var2.getCount(); ++var9) {
               var6 = var2.get(var9);
               FormatConditionCollection var10 = var6.a();
               if (var10 != null && var10.a(true)) {
                  var7 = new zbzb(var6);
                  var7.a(var1);
                  if (var6.b != null && 0 != var6.b.size()) {
                     var8 = new zbzh(var6.b.size());
                     var8.a(var1);

                     for(int var11 = 0; var11 < var6.b.size(); ++var11) {
                        if ((zbro)var6.b.get(var11) != null) {
                           this.a((zbro)var6.b.get(var11), var1);
                        }
                     }

                     var4 = new zcdb(1160);
                     var4.a(var1);
                     var4 = new zcdb(1148);
                     var4.a(var1);
                  }
               }
            }

            var4 = new zcdb(1150);
            var4.a(var1);
         }
      }
   }

   void a(zbro var1, com.aspose.cells.b.a.d.zh var2) throws Exception {
      zbyw var3 = new zbyw(var1);
      var3.a(var2);
      if (var1.e != null && var1.e.size() > 0) {
         zbyu var4 = new zbyu(var1.e.size());
         var4.a(var2);
         zbys var5 = null;
         zcdb var6 = null;
         zcdb var7 = null;
         zbyq var8 = null;
         zbqw var9 = null;
         ArrayList var10 = null;

         for(int var11 = 0; var11 < var1.e.size(); ++var11) {
            var9 = (zbqw)var1.e.get(var11);
            var5 = new zbys(var9);
            var5.a(var2);
            var10 = var9.c;

            for(int var12 = 0; var12 < var10.size(); ++var12) {
               var8 = new zbyq((Integer)var10.get(var12));
               var8.a(var2);
               var7 = new zcdb(1168);
               var7.a(var2);
            }

            var6 = new zcdb(1166);
            var6.a(var2);
         }

         zcdb var14 = new zcdb(1164);
         var14.a(var2);
      }

      zcdb var13 = new zcdb(1162);
      var13.a(var2);
   }

   void b(zbro var1, com.aspose.cells.b.a.d.zh var2) throws Exception {
      zbyx var3 = new zbyx(var1);
      var3.a(var2);
      if (var1.e != null && var1.e.size() > 0) {
         zbyv var4 = new zbyv(var1);
         var4.a(var2);
         zbyt var5 = null;
         zcdb var6 = null;
         zcdb var7 = null;
         zbyr var8 = null;
         zbqw var9 = null;
         ArrayList var10 = null;

         for(int var11 = 0; var11 < var1.e.size(); ++var11) {
            var9 = (zbqw)var1.e.get(var11);
            var5 = new zbyt(var9);
            var5.a(var2);
            var10 = var9.c;

            for(int var12 = 0; var12 < var10.size(); ++var12) {
               var8 = new zbyr((Integer)var10.get(var12));
               var8.a(var2);
               var7 = new zcdb(383);
               var7.a(var2);
            }

            var6 = new zcdb(252);
            var6.a(var2);
         }

         zcdb var14 = new zcdb(250);
         var14.a(var2);
      }

      zcdb var13 = new zcdb(248);
      var13.a(var2);
   }

   void l(com.aspose.cells.b.a.d.zh var1) throws Exception {
      zcdb var2 = new zcdb(287, this.a.getBaseFields().getCount());
      var2.a(var1);
      Iterator var3 = this.a.getBaseFields().a.iterator();

      while(var3.hasNext()) {
         PivotField var4 = (PivotField)var3.next();
         zbxs var5 = new zbxs(var4);
         var5.a(var1);
         this.c(var4, var1);
         this.b(var4, var1);
         this.a(var4, var1);
         zcdb var6 = new zcdb(286);
         var6.a(var1);
      }

      zcdb var7 = new zcdb(288);
      var7.a(var1);
   }

   void a(PivotField var1, com.aspose.cells.b.a.d.zh var2) throws Exception {
      if (var1.isRepeatItemLabels()) {
         zbzn var3 = new zbzn();
         var3.a(var2);
         zcaj var4 = new zcaj(var1);
         var4.a(var2);
         zcdb var5 = new zcdb(36);
         var5.a(var2);
      }
   }

   void b(PivotField var1, com.aspose.cells.b.a.d.zh var2) throws Exception {
      if (var1.e != null) {
         zbro var3 = var1.e;
         zcdb var4 = new zcdb(459);
         var4.a(var2);
         if (null != var3) {
            this.b(var3, var2);
         }

         zcdb var5 = new zcdb(460);
         var5.a(var2);
      }
   }

   void c(PivotField var1, com.aspose.cells.b.a.d.zh var2) throws Exception {
      if (var1.d != null && var1.d.getCount() != 0) {
         int var3 = this.a(var1);
         zcdb var4 = new zcdb(283, var3);
         var4.a(var2);
         boolean var5 = false;
         int var12;
         if (var1.isAutoSubtotals()) {
            var12 = var3 - 1;
         } else {
            var12 = var3;
         }

         var12 = Math.min(var12, var1.d.getCount());

         int var6;
         for(var6 = 0; var6 < var12; ++var6) {
            PivotItem var7 = var1.d.get(var6);
            if (var7.getIndex() != -1) {
               zbxr var8 = new zbxr(var7);
               var8.a(var2);
               zcdb var9 = new zcdb(281);
               var9.a(var2);
            }
         }

         if (var1.isAutoSubtotals()) {
            zbxr var13 = new zbxr(var1.isAutoSubtotals());
            var13.a(var2);
            zcdb var14 = new zcdb(281);
            var14.a(var2);
         } else if (!var1.getSubtotals(0)) {
            var6 = var1.b.a;

            for(int var16 = 1; var16 < 14; ++var16) {
               if (((var6 & '\uffff') >> var16 & 1) != 0) {
                  int var17 = 1 << var16;
                  byte var18 = zcee.H(var17);
                  zbxr var10 = new zbxr(var18);
                  var10.a(var2);
                  zcdb var11 = new zcdb(281);
                  var11.a(var2);
               }
            }
         }

         zcdb var15 = new zcdb(284);
         var15.a(var2);
      }
   }

   private int a(PivotField var1) {
      int var2 = var1.d.getCount();
      if (var1.isAutoSubtotals()) {
         ++var2;
      } else if (!var1.getSubtotals(0)) {
         int var3 = var1.b.a;

         for(int var4 = 1; var4 < 14; ++var4) {
            if (((var3 & '\uffff') >> var4 & 1) != 0) {
               ++var2;
            }
         }
      }

      return var2;
   }
}
